import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Vant from 'vant';
import 'vant/lib/index.css';
Vue.use(Vant);
Vue.config.productionTip = false
import 'amfe-flexible'

router.beforeEach((to,from,next)=>{
  if (to.meta.title){
    document.title = to.meta.title
  }
  if (to.meta.requireLogin){
    console.log('需要登陆')
    if (window.localStorage.getItem('user')){
      next()
    } else {
      next('/login')
    }
  }else {
    next()
  }
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
